package org.tloss.web.editor.database.editors.jdbc;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;

public class Column {
	private String schemaName;
	private String catalogName;
	private String tableName;
	private String columnName;
	private Integer dataType;
	private String typeName;
	private Integer columnSize;
	private Integer decimalDigits;
	private Integer numPrecRadix;
	private Integer nullable;
	private String remarks;
	private String columnDef;
	private Integer charOctetLength;
	private Integer ordinalPosition;
	private String isNullable;
	private String scopeCatlog;
	private String scopeSchema;

	private String scopeTable;
	private Short sourceDataType;
	private String isAutoincrement;

	private Mapping mapping;

	@XmlElement
	public Mapping getMapping() {
		return mapping;
	}

	public void setMapping(Mapping mapping) {
		this.mapping = mapping;
	}

	@XmlAttribute
	public String getSchemaName() {
		return schemaName;
	}

	public void setSchemaName(String schemaName) {
		this.schemaName = schemaName;
	}

	@XmlAttribute
	public String getCatalogName() {
		return catalogName;
	}

	public void setCatalogName(String catalogName) {
		this.catalogName = catalogName;
	}

	@XmlAttribute
	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	@XmlAttribute
	public String getColumnName() {
		return columnName;
	}

	public void setColumnName(String columnName) {
		this.columnName = columnName;
	}

	@XmlAttribute
	public Integer getDataType() {
		return dataType;
	}

	public void setDataType(Integer dataType) {
		this.dataType = dataType;
	}

	@XmlAttribute
	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	@XmlAttribute
	public Integer getColumnSize() {
		return columnSize;
	}

	public void setColumnSize(Integer columnSize) {
		this.columnSize = columnSize;
	}

	@XmlAttribute
	public Integer getDecimalDigits() {
		return decimalDigits;
	}

	public void setDecimalDigits(Integer decimalDigits) {
		this.decimalDigits = decimalDigits;
	}

	@XmlAttribute
	public Integer getNumPrecRadix() {
		return numPrecRadix;
	}

	public void setNumPrecRadix(Integer numPrecRadix) {
		this.numPrecRadix = numPrecRadix;
	}

	@XmlAttribute
	public Integer getNullable() {
		return nullable;
	}

	public void setNullable(Integer nullable) {
		this.nullable = nullable;
	}

	@XmlAttribute
	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	@XmlAttribute
	public String getColumnDef() {
		return columnDef;
	}

	public void setColumnDef(String columnDef) {
		this.columnDef = columnDef;
	}

	@XmlAttribute
	public Integer getCharOctetLength() {
		return charOctetLength;
	}

	public void setCharOctetLength(Integer charOctetLength) {
		this.charOctetLength = charOctetLength;
	}

	@XmlAttribute
	public Integer getOrdinalPosition() {
		return ordinalPosition;
	}

	public void setOrdinalPosition(Integer ordinalPosition) {
		this.ordinalPosition = ordinalPosition;
	}

	@XmlAttribute
	public String getIsNullable() {
		return isNullable;
	}

	public void setIsNullable(String isNullable) {
		this.isNullable = isNullable;
	}

	@XmlAttribute
	public String getScopeCatlog() {
		return scopeCatlog;
	}

	public void setScopeCatlog(String scopeCatlog) {
		this.scopeCatlog = scopeCatlog;
	}

	@XmlAttribute
	public String getScopeSchema() {
		return scopeSchema;
	}

	public void setScopeSchema(String scopeSchema) {
		this.scopeSchema = scopeSchema;
	}

	@XmlAttribute
	public String getScopeTable() {
		return scopeTable;
	}

	public void setScopeTable(String scopeTable) {
		this.scopeTable = scopeTable;
	}

	@XmlAttribute
	public Short getSourceDataType() {
		return sourceDataType;
	}

	public void setSourceDataType(Short sourceDataType) {
		this.sourceDataType = sourceDataType;
	}

	@XmlAttribute
	public String getIsAutoincrement() {
		return isAutoincrement;
	}

	public void setIsAutoincrement(String isAutoincrement) {
		this.isAutoincrement = isAutoincrement;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((catalogName == null) ? 0 : catalogName.hashCode());
		result = prime * result
				+ ((charOctetLength == null) ? 0 : charOctetLength.hashCode());
		result = prime * result
				+ ((columnDef == null) ? 0 : columnDef.hashCode());
		result = prime * result
				+ ((columnName == null) ? 0 : columnName.hashCode());
		result = prime * result
				+ ((columnSize == null) ? 0 : columnSize.hashCode());
		result = prime * result
				+ ((dataType == null) ? 0 : dataType.hashCode());
		result = prime * result
				+ ((decimalDigits == null) ? 0 : decimalDigits.hashCode());
		result = prime * result
				+ ((isAutoincrement == null) ? 0 : isAutoincrement.hashCode());
		result = prime * result
				+ ((isNullable == null) ? 0 : isNullable.hashCode());
		result = prime * result
				+ ((nullable == null) ? 0 : nullable.hashCode());
		result = prime * result
				+ ((numPrecRadix == null) ? 0 : numPrecRadix.hashCode());
		result = prime * result
				+ ((ordinalPosition == null) ? 0 : ordinalPosition.hashCode());
		result = prime * result + ((remarks == null) ? 0 : remarks.hashCode());
		result = prime * result
				+ ((schemaName == null) ? 0 : schemaName.hashCode());
		result = prime * result
				+ ((scopeCatlog == null) ? 0 : scopeCatlog.hashCode());
		result = prime * result
				+ ((scopeSchema == null) ? 0 : scopeSchema.hashCode());
		result = prime * result
				+ ((scopeTable == null) ? 0 : scopeTable.hashCode());
		result = prime * result
				+ ((sourceDataType == null) ? 0 : sourceDataType.hashCode());
		result = prime * result
				+ ((tableName == null) ? 0 : tableName.hashCode());
		result = prime * result
				+ ((typeName == null) ? 0 : typeName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Column other = (Column) obj;
		if (catalogName == null) {
			if (other.catalogName != null)
				return false;
		} else if (!catalogName.equals(other.catalogName))
			return false;
		if (charOctetLength == null) {
			if (other.charOctetLength != null)
				return false;
		} else if (!charOctetLength.equals(other.charOctetLength))
			return false;
		if (columnDef == null) {
			if (other.columnDef != null)
				return false;
		} else if (!columnDef.equals(other.columnDef))
			return false;
		if (columnName == null) {
			if (other.columnName != null)
				return false;
		} else if (!columnName.equals(other.columnName))
			return false;
		if (columnSize == null) {
			if (other.columnSize != null)
				return false;
		} else if (!columnSize.equals(other.columnSize))
			return false;
		if (dataType == null) {
			if (other.dataType != null)
				return false;
		} else if (!dataType.equals(other.dataType))
			return false;
		if (decimalDigits == null) {
			if (other.decimalDigits != null)
				return false;
		} else if (!decimalDigits.equals(other.decimalDigits))
			return false;
		if (isAutoincrement == null) {
			if (other.isAutoincrement != null)
				return false;
		} else if (!isAutoincrement.equals(other.isAutoincrement))
			return false;
		if (isNullable == null) {
			if (other.isNullable != null)
				return false;
		} else if (!isNullable.equals(other.isNullable))
			return false;
		if (nullable == null) {
			if (other.nullable != null)
				return false;
		} else if (!nullable.equals(other.nullable))
			return false;
		if (numPrecRadix == null) {
			if (other.numPrecRadix != null)
				return false;
		} else if (!numPrecRadix.equals(other.numPrecRadix))
			return false;
		if (ordinalPosition == null) {
			if (other.ordinalPosition != null)
				return false;
		} else if (!ordinalPosition.equals(other.ordinalPosition))
			return false;
		if (remarks == null) {
			if (other.remarks != null)
				return false;
		} else if (!remarks.equals(other.remarks))
			return false;
		if (schemaName == null) {
			if (other.schemaName != null)
				return false;
		} else if (!schemaName.equals(other.schemaName))
			return false;
		if (scopeCatlog == null) {
			if (other.scopeCatlog != null)
				return false;
		} else if (!scopeCatlog.equals(other.scopeCatlog))
			return false;
		if (scopeSchema == null) {
			if (other.scopeSchema != null)
				return false;
		} else if (!scopeSchema.equals(other.scopeSchema))
			return false;
		if (scopeTable == null) {
			if (other.scopeTable != null)
				return false;
		} else if (!scopeTable.equals(other.scopeTable))
			return false;
		if (sourceDataType == null) {
			if (other.sourceDataType != null)
				return false;
		} else if (!sourceDataType.equals(other.sourceDataType))
			return false;
		if (tableName == null) {
			if (other.tableName != null)
				return false;
		} else if (!tableName.equals(other.tableName))
			return false;
		if (typeName == null) {
			if (other.typeName != null)
				return false;
		} else if (!typeName.equals(other.typeName))
			return false;
		return true;
	}	
}
